package com.itheima.order.controller;

import com.itheima.order.pojo.Order;
import com.itheima.order.service.OrderService;
import entity.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("order")
public class OrderController {
    @Autowired
    private OrderService orderService;

    @GetMapping("submitInfo/{goodId}")
    public Result submitInfo(@PathVariable("goodId") Long goodId) {

        return this.orderService.getSubmitInfo(goodId);
    }

    @PostMapping("submitOrder")
    public Result submitOrder(@RequestBody Order order) {
        return this.orderService.submitOrder(order);
    }
}
